<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 页面的渲染时机是在所有的数据改变完以后 -->

    <!-- 是跟虚拟dom有关 -->
    <!-- 是更新阶段的生命周期有关 -->

    <!-- this.$nextTick里面的回调函数会在dom更新完以后再调用 -->
    <div id="app">
      <p>count: {{count}}</p>
      <button @click="fn">btn</button>
    </div>

    <script src="./vue.js"></script>
    <script>
      Vue.createApp({
        data() {
          return {
            count: 1,
          };
        },
        methods: {
          fn() {
            this.count++;
            this.count++;
            this.count++;
            this.$nextTick(() => {
              console.log(document.querySelector("p").innerHTML);
            });
          },
        },
      }).mount("#app");
    </script>
  </body>
</html>
